<#include "/common/_header.html" />
<div class="page-group"><!-- 页面组 -->
	<div class="page page-current"><!-- 页面组中的每一个页面，可以互相跳转 -->
		<header class="bar bar-nav"><!-- 每个页面的头部 -->
			<h1 class="title"><#if ttype="0">后台管理系统<#else>商家专属管理系统</#if></h1>
		</header>
		<div class="content native-scroll"><!-- 每个页面的内容区域 -->
			<div class="list-block">
			    <ul>
			      <li>
			        <div class="item-content">
			          <div class="item-media"><i class="icon icon-form-email"></i></div>
			          <div class="item-inner">
			            <div class="item-title label">账号</div>
			            <div class="item-input">
			              <input type="text" id="username" placeholder="商家编号" value="${keepUsername!}">
			            </div>
			          </div>
			        </div>
			      </li>
			      <li>
			        <div class="item-content">
			          <div class="item-media"><i class="icon icon-form-password"></i></div>
			          <div class="item-inner">
			            <div class="item-title label">密码</div>
			            <div class="item-input">
			              <input type="password" id="passwd" placeholder="密码" value="${keepPassword!}">
			            </div>
			          </div>
			        </div>
			      </li>
				</ul>
			</div>
		    <div class="content-block">
				<h2><a href="#" class="button button-big button-fill button-success" onclick="login()">登录</a></h2>
		    </div>			
		</div>
	</div>
</div>
<#include "/common/_footer.html" />
<script>
function login(){
	if($("#username").val().trim()==''){
		$.toast("请输入账号");
		return;
	}else if($("#passwd").val().trim()==''){
		$.toast("请输入密码");
		return;
	}
	$.showIndicator();
	$.ajax({
		type:'post',
		url:'${path}/sellerlogin/login',
		data:{"username":$("#username").val(),"passwd":$("#passwd").val(),"ttype":"${ttype}","openid":"${openid}"},
		success:function(data){
			if(data != '0'){
				location.href="${path}/sellerlogin/loginSuccess?ttype=${ttype}&sellerid="+data;
			}else{
				$.toast("账号或密码不正确");
			}
			console.log("ajax success:"+data);
			$.hideIndicator();
		},
		error:function(xhr,errorType , error) {
			console.log("sorry error\r\n");
		}
	});
}
</script>